<form action="/admin/pro/sn-add" id="sn-code-lists" data-toggle="ajaxform" data-options="{closeCurrent:true}">
    <div class="bjui-row">
        <div class="bjui-row col-2">
            <label class="row-label">生成数量</label>
            <div class="row-input">
                <input type="text" name="number" id="number" value="">
            </div>
        </div>

        <div class="bjui-row col-2">
            <label class="row-label">可用次数</label>
            <div class="row-input">
                <input type="text" name="total_number" id="total_number" value="">
            </div>
        </div>

        <div class="bjui-row col-2">
            <input type="hidden" name="product_id" id="product_id" value="0">
            <label class="row-label">选择材料</label>
            <div class="row-input">
                <button type="button" id="product_id_choose" class="btn btn-info" data-toggle="dialog"
                    data-options="{
                            id:'product-list-for-select-dialog',
                            title:'选择材料',
                            fresh:true,
                            height:400,
                            width:400,
                            url:'/admin/pro/product-list-for-select'
                        }"
                >
                    选择
                </button>
            </div>
        </div>


        <input type="hidden" name="act" id="act" value="save">

        <div class="bjui-row col-2">
            <div class="row-input">
                <label class="row-label"></label>
                <button type="submit" class="btn-default" data-icon="save">生成</button>
                <button type="button" class="btn btn-green"  onclick="signOut();"  data-icon="sign-out">
                    生成并导出
                </button>
                <button type="button" class="btn-close" data-icon="close">取消</button>
            </div>
        </div>
    </div>
</form>
<script type="text/javascript">
    var DownLoadFile = function (options) {
        var config = $.extend(true, { method: 'post' }, options);
        var $iframe = $('<iframe id="down-file-iframe" />');
        var $form = $('<form target="down-file-iframe" method="' + config.method + '" />');
        $form.attr('action', config.url);
        for (var key in config.data) {
            $form.append('<input type="hidden" name="' + key + '" value="' + config.data[key] + '" />');
        }
        $iframe.append($form);
        $(document.body).append($iframe);
        $form[0].submit();
        $iframe.remove();
    };

    function signOut(){
            //调用
            DownLoadFile({
                url:'/admin/pro/sn-add', //请求的url
                data:{//要发送的数据
                        act:'sign_out',
                        number:$('#number').val(),
                        total_number:$('#total_number').val(),
                        product_id:$('#product_id').val(),
                        _token : '{{ csrf_token() }}'
                    }
            });
    }
</script>